package sk.hackcraft.util.agent_simulation.agent;

import sk.hackcraft.util.agent_simulation.AgentSimulation;
import sk.hackcraft.util.agent_simulation.AgentSimulationComponent;
import java.util.Set;
import java.util.TreeSet;

public abstract class Agent extends AgentSimulationComponent
{
	private Manager manager;
	private ContinualAssistant continualAssistant;
	private PromptAssistant promptAssistant;
	
	private Agent superiorAgent;
	private Set<Agent> subordinateAgents;
	
	@SuppressWarnings("LeakingThisInConstructor")
	public Agent(AgentSimulation agentSimulation, Agent superiorAgent)
	{
		super(agentSimulation);
		
		this.subordinateAgents = new TreeSet<Agent>();
		this.superiorAgent = superiorAgent;
		
		if(superiorAgent != null)
		{
			superiorAgent.addSubordinateAgent(this);
		}
	}
	
	protected void addSubordinateAgent(Agent subordinateAgent)
	{
		this.subordinateAgents.add(subordinateAgent);
	}
	
	protected Agent getSuperiorAgent()
	{
		return superiorAgent;
	}
	
	protected Set<Agent> getSubordinateAgents()
	{
		return subordinateAgents;
	}

	public Manager getManager()
	{
		return manager;
	}

	public void setManager(Manager manager)
	{
		this.manager = manager;
	}

	public ContinualAssistant getContinualAssistant()
	{
		return continualAssistant;
	}

	public void setContinualAssistant(ContinualAssistant continualAssistant)
	{
		this.continualAssistant = continualAssistant;
	}
	
	public boolean hasContinualAssistant()
	{
		return continualAssistant != null;
	}
	
	public PromptAssistant getPromptAssistant()
	{
		return promptAssistant;
	}

	public void setPromptAssistant(PromptAssistant promptAssistant)
	{
		this.promptAssistant = promptAssistant;
	}
	
	public boolean hasPromptAssistant()
	{
		return promptAssistant != null;
	}
}
